
#import "KeyEventResponder.h"
#import "NewsgroupSet.h"
#import "ArticleSet.h"

@implementation KeyEventResponder

- setNGSet:sender
{
   theNewsgroupSet=sender;

   return self;
}

- setArticleSet:sender
{
   theArticleSet=sender;

   return self;
}

- keyDown:(NXEvent *)theEvent
{
   if(theEvent->data.key.repeat!=0)
      return self;

   if(theEvent->data.key.charCode==173){
      [theNewsgroupSet up:self];
      return self;
   }
   if(theEvent->data.key.charCode==175){
      [theNewsgroupSet down:self];
      return self;
   }
   if(theEvent->data.key.charCode==32){
		if(theEvent->flags & NX_SHIFTMASK)
			[theNewsgroupSet upOnePage:self];
		else
      	[theNewsgroupSet downOnePage:self];
      return self;
   }
   if(theEvent->data.key.charCode==174){
      [theArticleSet skipThreadAndDown:self];
      return self;
   }
   if(theEvent->data.key.charCode==172){
      [theArticleSet skipThreadAndUp:self];
      return self;
   }

   return [super keyDown:theEvent];
}

@end
